package com.minimoment.model.action;

import com.minimoment.base.BaseAction;
import com.minimoment.model.domain.Theater;
import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * Created by etund on 2014/11/9.
 */
@Controller
@Scope("prototype")
public class TheaterAction extends BaseAction<Theater> {
    private String result;
    private String movieId;
    private JSONArray resultTree;
    public String getTheaterByMovieId(){
              if(movieId!=null){
                  theaters = this.theaterService.getByMovieId(Long.parseLong(movieId));
                  JsonConfig jsonConfig = new JsonConfig();
                  jsonConfig.setExcludes(new String[]{"movies","screeningses","histories","users"});
                  resultTree = JSONArray.fromObject(theaters,jsonConfig);
                  result = resultTree.toString();
        }
           return "getTheaterByMovieId";
    }

    public JSONArray getResultTree() {
        return resultTree;
    }

    public void setResultTree(JSONArray resultTree) {
        this.resultTree = resultTree;
    }

    public String getMovieId() {
        return movieId;
    }

    public void setMovieId(String movieId) {
        this.movieId = movieId;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }
}
